#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

#include<string.h>

int main() {
	char a[1000] = {0};
	char b[1000] = { 0 };
	fgets(a, sizeof(a), stdin);
	fgets(b, sizeof(b), stdin);
	int n;
	scanf("%d", &n);
	int x = strlen(a);
	int y = strlen(b);
	if (a[x - 1] == '\n') a[--x] = '\0';
	if (b[y - 1] == '\n') b[--y] = '\0';
	for (int i = x - 1 ; i >= n; i--) {
		a[i + y] = a[i];
	}
	for (int j = 0; j < y; j++) {
		a[n + j] = b[j];
	}
	puts(a);
	return 0;
}